create table Price
(
	 [PriceId] int identity(1, 1) primary key
	,[ItemId] int
	,[ItemType] int
	,[AgeId] int
	,[Time] nvarchar(128)
	,[NationalId] int
	,[SalePrice] decimal
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE PriceGet
	@PriceId int
AS
SELECT *
FROM [Price]
WHERE [Price].[PriceId] = @PriceId
GO

CREATE PROCEDURE PriceList
AS
SELECT *
FROM [Price]
ORDER BY PriceId DESC
GO

CREATE PROCEDURE PriceInsert
	@ItemId int
	,@ItemType int
	,@AgeId int
	,@Time nvarchar(128)
	,@NationalId int
	,@SalePrice decimal(18, 0)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO Price (
	 [ItemId]
	,[ItemType]
	,[AgeId]
	,[Time]
	,[NationalId]
	,[SalePrice]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @ItemId
	,@ItemType
	,@AgeId
	,@Time
	,@NationalId
	,@SalePrice
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

CREATE PROCEDURE PriceUpdate
	@PriceId int, 
	@ItemId int, 
	@ItemType int, 
	@AgeId int, 
	@Time nvarchar(128), 
	@NationalId int, 
	@SalePrice decimal(18, 0), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE Price SET
	   [ItemId] = @ItemId
	   ,[ItemType] = @ItemType
	   ,[AgeId] = @AgeId
	   ,[Time] = @Time
	   ,[NationalId] = @NationalId
	   ,[SalePrice] = @SalePrice
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Price].[PriceId] = @PriceId
GO

CREATE PROCEDURE PriceDelete
	@PriceId int 
AS
DELETE FROM Price
WHERE [Price].[PriceId] = @PriceId
GO